package com.sharkburner.aeris.dao.entity;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the category database table.
 * 
 */
@Entity
@Table(name="category")
public class Category implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique=true, nullable=false, length=100)
	private String name;

	@Column(nullable=false, length=200)
	private String descr;

	//bi-directional many-to-many association to Article
    @ManyToMany
	@JoinTable(
		name="category_article"
		, joinColumns={
			@JoinColumn(name="Category_name", nullable=false)
			}
		, inverseJoinColumns={
			@JoinColumn(name="Article_id", nullable=false)
			}
		)
	private List<Article> articles;

	//bi-directional many-to-many association to Site
	@ManyToMany(mappedBy="categories")
	private List<Site> sites;

    public Category() {
    }

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescr() {
		return this.descr;
	}

	public void setDescr(String descr) {
		this.descr = descr;
	}

	public List<Article> getArticles() {
		return this.articles;
	}

	public void setArticles(List<Article> articles) {
		this.articles = articles;
	}
	
	public List<Site> getSites() {
		return this.sites;
	}

	public void setSites(List<Site> sites) {
		this.sites = sites;
	}
	
}